package com.lagou.edu.mvcframework.pojo;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author xingyi
 */
public class DualKeyMap<K1, K2, V> {
    private Map<K1, V> k1Map = new HashMap<>();
    private Map<K2, V> k2Map = new HashMap<>();

    public void put(K1 k1, K2 k2, V val) {
        k1Map.put(k1, val);
        k2Map.put(k2, val);
    }

    public V getByK1(K1 k1) {
        return k1Map.get(k1);
    }

    public V getByK2(K2 k2) {
        return k2Map.get(k2);
    }

    public Collection<V> values() {
        return k1Map.values();
    }

    public int size() {
        return k1Map.size();
    }
}
